use rand::Rng;
fn check_sorted_prop(sortedarray: &SortedArray) {
    for i in 1..sortedarray_length(sortedarray) {
        assert!(
            int_compare(
                sortedarray_get(sortedarray, i - 1),
                sortedarray_get(sortedarray, i)
            ) <= 0
        );
    }
}
fn free_sorted_ints(sortedarray: &mut SortedArray) {
    for i in 0..sortedarray_length(sortedarray) {
        unsafe {
            let pi: *mut i32 = sortedarray_get(sortedarray, i) as *mut i32;
            libc::free(pi as *mut libc::c_void);
        }
    }
    sortedarray_free(sortedarray);
}
fn generate_sortedarray_equ() -> *mut SortedArray {
    unsafe { generate_sortedarray_equ() }
}
#[test]
fn test_sortedarray_new_free() {
    let arr = generate_sortedarray();
    for i in 0..sortedarray_length(&arr) {
        assert_eq!(sortedarray_get(&arr, i), sortedarray_get(&arr, i));
        assert_eq!(
            *(sortedarray_get(&arr, i) as *const i32),
            *(sortedarray_get(&arr, i) as *const i32)
        );
    }
    free_sorted_ints(arr);
}
fn ptr_equal(v1: SortedArrayValue, v2: SortedArrayValue) -> bool {
    v1 == v2
}
fn main() {
    run_tests(tests);
    println!("num_assert: {}", num_assert);
}
